<template>
  <RouterView />
</template>
<script lang="ts" setup>
import { useRoute } from 'vue-router';
import logger from './utils/logger';
import { onMounted, watch } from 'vue';
import { isMobile, resize, setHtmlFontSize, setWebTitle } from './utils';
import { useEventListener } from '@vueuse/core'
import { useLayoutStore } from './store/modules/layout';


logger.setNamespace("App")
logger.info("------------------进入App------------------")

const route = useRoute()
const layoutStore = useLayoutStore()

onMounted(() => {
  useEventListener(window, "resize", resize)
  setHtmlFontSize()
  if (isMobile()) {
    layoutStore.setCollapse(true)
  }
})


//路由变化设置网页标题
watch(() => route.path, () => setWebTitle(route))
</script>
<style lang="less">
#app {
  width: 100%;
  height: 100%;
  background-color: rgb(244, 247, 252);
}
</style>